/*=========================================================================

  Program:   Visualization Toolkit
  Module:    vtkPolyDataAlgorithm.h

  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
  All rights reserved.
  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.

     This software is distributed WITHOUT ANY WARRANTY; without even
     the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
     PURPOSE.  See the above copyright notice for more information.

=========================================================================*/

// PURPOSE: test new vtkContinuousScatterplot filter
#include <cstring>
#include <sstream>
#include <string>

#include "vtkContinuousScatterplot.h"
#include "vtkTestUtilities.h"
#include <vtkActor.h>
#include <vtkImageActor.h>
#include <vtkImageData.h>
#include <vtkImageMapper3D.h>
#include <vtkImageWriter.h>
#include <vtkJPEGWriter.h>
#include <vtkPolyData.h>
#include <vtkPolyDataMapper.h>
#include <vtkRenderWindow.h>
#include <vtkRenderWindowInteractor.h>
#include <vtkRenderer.h>
#include <vtkSmartPointer.h>
#include <vtkUnstructuredGrid.h>
#include <vtkXMLImageDataWriter.h>
#include <vtkXMLUnstructuredGridReader.h>

int TestContinuousScatterPlot(int argc, char* argv[])
{
  std::string outputString;
  bool pass = true;

  char* inputFile = vtkTestUtilities::ExpandDataFileName(argc, argv, "Data/cube.vtu");

  int ResX[5] = { 10, 20, 30, 40, 50 };
  int ResY[5] = { 10, 20, 30, 40, 50 };

  char fieldOneName[] = "f1";
  char fieldTwoName[] = "f2";

  int cmpIndex = 0;

  /********************* Desired output arrays *********************/
  std::string dataToCompare[5] = { "2,1,0,0,0,0,0,0,0,0,2,17,9,0,0,0,0,0,0,0,0,12,44,28,0,0,0,0,0,"
                                   "0,0,0,40,81,64,0,0,0,0,0,0,0,0,42,137,112,0,0,0,0,0,0,0,0,48,"
                                   "181,159,0,0,0,0,0,0,0,0,46,255,215,0,0,0,0,0,0,0,0,34,208,152,"
                                   "0,0,0,0,0,0,0,0,18,157,55,0,0,0,0,0,0,0,0,5,61",

    "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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0,0,0,0,0,"
    "0,0,0,0,0,0,0,0,0,0,0,0,1,28,64,63,37,5,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"
    "0,0,0,0,0,0,0,0,1,27,68,71,48,4,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"
    "0,0,0,0,0,27,116,86,60,2,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"
    "0,0,74,123,120,78,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"
    "75,144,143,34,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,75,"
    "147,141,39,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,74,165,"
    "156,163,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,71,170,252,"
    "189,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,68,143,255,191,"
    "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,63,145,255,181,0,0,"
    "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,60,144,244,159,0,0,0,0,"
    "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,53,143,222,133,0,0,0,0,0,0,"
    "0,0,0,0,0,0,0,0,0,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,0,0,0,0,"
    "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,24,132,121,35,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"
    "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,20,94,150,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"
    "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16,141,159,0,0,0,0,0,0,0,0,0,0,0,0,"
    "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,13,124,109,0,0,0,0,0,"
    "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,10,79,"
    "77,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"
    "0,0,0,7,55,49,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"
    "0,0,0,0,0,0,0,0,5,37,28,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"
    "0,0,0,0,0,0,0,0,0,0,0,0,0,3,22,13,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"
    "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,11,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,"
    "0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0" };

  /************** output to error log ****************/
  /****************************************************/

  /****************************************************/

  for (int i = 0; i < 5; i++)
  {

    // read .vtu file from the command line
    vtkSmartPointer<vtkXMLUnstructuredGridReader> mesh_reader =
      vtkSmartPointer<vtkXMLUnstructuredGridReader>::New();
    mesh_reader->SetFileName(inputFile);
    mesh_reader->Update();

    // Define the CSP filter.
    vtkSmartPointer<vtkContinuousScatterplot> csp =
      vtkSmartPointer<vtkContinuousScatterplot>::New();
    csp->SetInputData(mesh_reader->GetOutput());
    csp->SetField1(fieldOneName, ResX[cmpIndex]);
    csp->SetField2(fieldTwoName, ResY[cmpIndex]);
    csp->Update();

    /************** Console output ****************/
    {
      std::stringstream ss;
      int indexLocal = 0;

      // Retrieve the entries from the image data
      for (int z = 0; z < 1; z++)
      {
        for (int y = 0; y < ResY[cmpIndex]; y++)
        {
          for (int x = 0; x < ResX[cmpIndex]; x++)
          {
            double* pixel = static_cast<double*>(csp->GetOutput()->GetScalarPointer(x, y, z));
            if (indexLocal > 0)
            {
              outputString.append(",");
            }
            ss << (int)(pixel[0] + 0.5);
            outputString.append(ss.str());
            ss.str(std::string());
            ss.clear();
            indexLocal++;
          }
        }
      }

    } // end of console output

    /*********** comparing the strings ************/
    if (strcmp(outputString.c_str(), dataToCompare[cmpIndex].c_str()) != 0)
    {
      pass = false;
      { // writing to file
        printf("\n\n/**************************************/");
        printf("\n/********Test Unsuccessful*************/");
        printf("\nInput Data: %s", (std::string(inputFile).substr(6, 49)).c_str());
        printf("\nCS Plot test case %d x %d \n", ResX[cmpIndex], ResY[cmpIndex]);
        printf("\nString to compare: %s", dataToCompare[cmpIndex].c_str());
        printf("\nOutput String     : %s", outputString.c_str());
        printf("\n/**************************************/");
      } // end of writing
    }

    cmpIndex++;
    outputString = "";

  } // end for

  delete[] inputFile;

  if (pass)
  {
    cout << "\nTest Successful!!!" << endl;
    return EXIT_SUCCESS;
  }

  cout << "\nTest Unsuccessful." << endl;
  return EXIT_FAILURE;
}
